package com.lifang.imsoa.util;

import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public enum Global {
	;
	
	private static final Logger logger = LoggerFactory.getLogger(Global.class);

	public final static String ENV;
	
	public static String DEFAULT_PASSWORD = "123456";
	public static String API_HTTP_SCHEMA = "https";
	public static String API_SERVER_HOST = "a1.easemob.com";
	public final static HxConfigEnum jrspHxConfig;
	public final static HxConfigEnum yfykHxConfig;
    public final static String QUARTZTASK_RUN_IP;
	
	static {
		ENV = Config.get("env");
		jrspHxConfig = HxConfigEnum.getHxConfigByEnvAndAppName("JRSP");
		yfykHxConfig = HxConfigEnum.getHxConfigByEnvAndAppName("YFYK");
        QUARTZTASK_RUN_IP = Config.get("S_constants.quartzTask_run_IP");
	}

	private static class Config {

		static Properties properties = new Properties();
		static {
			try {
				properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties"));
			} catch (Exception e) {
				logger.error("config.properties error!!!", e);
			}

		}

		public static String get(String key) {
			return properties.getProperty(key);
		}

		@SuppressWarnings("unused")
		public static Integer _get(String key) {
			return Integer.parseInt(properties.getProperty(key));
		}

	}
}
